<?php
namespace app\admin\controller;
use think\Db;
use think\facade\{
    Config,Request,Cache,App
};
class Orderoatransfer extends Base
{
    //列表
    public function lists(){
      if(is_post()){
          $d = $this->post;
          $map = [];
          if($d['keyword']) $map[] = ['and',"b.username|a.order_no","like","%{$d['keyword']}%"];
          // if($d['money_type']) $map[] = ['and',"a.money_type","=",$d['money_type']];
          if($d['min_time']) $map[] = ['and','a.create_time','>=',strtotime($d['min_time'])];
          if($d['max_time']) $map[] = ['and','a.create_time','<=',strtotime($d['max_time'])];
          $w  = where($map);
          $sql = "select a.*,b.username from order_oatransfer a left join user b on a.user_id=b.id  $w[0] order by a.id desc".limit($d['page'],$d['limit']);
          $rs = $this->db->query($sql, $w[1],'',true);
          if($rs){
              $rule = [
                  'create_time' => 'com_time_format',
              ];
              $data = com_format($rs[0],$rule);
              return suc($data, $rs[1]);
          }else{
              suc([],0);
          }
      }
      $this->fetch();
    }

}
